package com.dcy.web.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.dcy.common.base.controller.DcyBaseController;
import com.dcy.common.constant.PermissionConstant;
import com.dcy.common.model.PageModel;
import com.dcy.common.model.PageResult;
import com.dcy.common.model.R;
import com.dcy.common.utils.satoken.StpAdminUtil;
import com.dcy.system.service.LogService;
import com.dcy.system.vo.in.LogSearchInVO;
import com.dcy.system.vo.out.LogListOutVO;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 日志表 前端控制器
 * </p>
 *
 * @author dcy
 * @since 2021-01-06
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/log")
@ApiSupport(order = 35)
@Api(value = "LogController", tags = {"日志接口"})
public class LogController extends DcyBaseController {

    private final LogService logService;

    @SaCheckPermission(value = PermissionConstant.LOG_LIST, type = StpAdminUtil.TYPE)
    @ApiOperation(value = "日志表分页查询")
    @GetMapping("/page")
    public R<PageResult<LogListOutVO>> pageList(LogSearchInVO logSearchInVO, PageModel pageModel) {
        return success(logService.pageListByEntity(logSearchInVO, pageModel));
    }

}
